/*
 * @Descripttion: 转换请求或者响应data
 * @version:
 * @Author: yangzhihao
 * @Date: 2021-07-12 11:29:52
 * @LastEditors: yangzhihao
 * @LastEditTime: 2021-07-14 15:01:00
 */
import { isObject } from '.'
export function transformRequest(data: any) {
  if (isObject(data)) {
    return JSON.stringify(data)
  }
  return data
}

export function transformResponse(data: any): any {
  if (typeof data === 'string') {
    try {
      data = JSON.parse(data)
    } catch (error) {
      console.log(error)
    }
  }
  return data
}
